from utils import django_setup
import re


django_setup.setup_django_model()


def retrieve_film_popular_name():
    from apis_1_0.models import Movie

    movies = Movie.objects.all()
    for movie in movies:
        ori_name = movie.translated_name
        popular_name = ori_name
        if "/" in ori_name:
            popular_name = ori_name.split("/")[0].strip()
        movie.name = popular_name
        movie.save()


if __name__ == "__main__":
    retrieve_film_popular_name()
